import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite';
import { VantResolver } from 'unplugin-vue-components/resolvers';
// https://vitejs.dev/config/
export default defineConfig({
  server:{
    proxy:{
    "/api":{
    target:"http://localhost:5173",
    // target:"https://console-mock.apipost.cn/app/mock/project/0ee834d6-9f29-475c-91fa-db4ef3804366",
     changeOrigin:true,
     rewrite:(path)=> path.replace(/^\/api/,"")
    }
    }
     },
  plugins: [
    vue(),
    Components({
      resolvers: [VantResolver()],
    }),
  ],
  base:'./',
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  }
})
